# @File: __init__.py.py
# -*- coding: utf-8 -*-
# __author:"super"
# @time:2025/7/27 19:24
from get_testcases.runner.base import Runner
from get_testcases.runner.context import runner_context
from get_testcases.runner.models import RunConfig
from get_testcases.runner.parallel import ProcessesRunner, ThreadsRunner

__all__ = [
    "Runner",
    "ProcessesRunner",
    "ThreadsRunner",
    "run",
    "threads_run",
    "processes_run",
    "run_tests",
    "RunConfig"
]


RUN_MODE_MAP = {
    "main": Runner,
    "mp": ProcessesRunner,
    "mt": ThreadsRunner
}


def run_tests(run_config: RunConfig):
    run_mode = RUN_MODE_MAP.get(run_config.run_mode, Runner)
    with runner_context(run_config):
        runner = run_mode()
        runner.run(run_config)


run = Runner().run
threads_run = ThreadsRunner().run
processes_run = ProcessesRunner().run
